package com.witmore.skyline.web.controller.enums;

import lombok.Getter;

/**
 * Description: CameraPicSourceTypeEnum
 * Author: 豆子高
 * Date: 2025/3/17 17:26
 */
@Getter
public enum CameraPicSourceTypeEnum {
    // 1、定时任务拉取的图片 2、（云抓图）用户抓拍图  3、（本地截屏）用户抓拍图

    SCHEDULED_TASK(1, "定时任务拉取的图片"),
    USER_CAPTURE_IMAGE_CLOUD(2, "（云抓图）用户抓拍图"),
    USER_CAPTURE_IMAGE_LOCAL(3, "（本地截屏）用户抓拍图"),
    ;

    private final Integer code;
    private final String name;

    CameraPicSourceTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    // 根据code获取name
    public static String getNameByCode(Integer code) {
        for (CameraPicSourceTypeEnum workStatusEnum : CameraPicSourceTypeEnum.values()) {
            if (workStatusEnum.getCode().equals(code)) {
                return workStatusEnum.getName();
            }
        }
        return CameraPicSourceTypeEnum.SCHEDULED_TASK.getName();
    }

    // 根据code获取枚举
    public static CameraPicSourceTypeEnum getEnumByCode(Integer code) {
        for (CameraPicSourceTypeEnum workStatusEnum : CameraPicSourceTypeEnum.values()) {
            if (workStatusEnum.getCode().equals(code)) {
                return workStatusEnum;
            }
        }
        return CameraPicSourceTypeEnum.SCHEDULED_TASK;
    }


}
